<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <h2>用户登陆</h2>
    <p>账号：<input type="text" id="uname"></p>
    <p>密码：<input type="text" id="upassword"></p>
    <p><input type="radio" id="IfRemember">记住密码</p>
    <p><button id="bun">登陆</button></p>

    <script>
    document.getElementById('bun').onclick = function () {
        let uname = document.getElementById("uname").value;
        let upassword = document.getElementById("upassword").value;
        let number =1;
        let count ='count';
        if(sessionStorage.getItem('UserInfo')==null) {

            if(localStorage.getItem('count')==null) {//本地永久域为空

                localStorage.setItem('count',JSON.stringify({ count , number}));
            }
            else {
              let  counts=  JSON.parse(localStorage.getItem('count'));
              number++;
              localStorage.setItem('count',JSON.stringify({ count , number}));

            }

            //给回话域加元素
            sessionStorage.setItem('userInfo',JSON.stringify({uname , upassword}));
        }
    }

    </script>
</body>
</html>